# source:https://www.lanqiao.cn/problems/17117/learning/ 0-1背包变形 滚动数组
# 读取输入
num, a, b = map(int, input().strip().split())
weight = list(map(int, input().strip().split()))

# 初始化 DP 数组，dp[a][b] 表示车厢1剩余容量为a，车厢2剩余容量为b时的最大运输重量
dp = [[0] * (b + 1) for _ in range(a + 1)]
# dp[a][b] = 0  # 初始状态：两个车厢都满，未装任何钢材

# 动态规划
for i in range(num):
    # 创建新的 DP 数组来存储当前阶段的结果
    new_dp = [[0] * (b + 1) for _ in range(a + 1)]
    for x in range(a + 1):
        for y in range(b + 1):
            # 选择1：不放当前钢材
            new_dp[x][y] = dp[x][y]
            # 选择2：放入车厢1（如果容量足够）
            if weight[i] <= x:
                new_dp[x][y] = max(dp[x - weight[i]][y] + weight[i], dp[x][y])
            # 选择3：放入车厢2（如果容量足够）
            if weight[i] <= y:
                new_dp[x][y] = max(dp[x][y - weight[i]] + weight[i], new_dp[x][y])
    dp = new_dp

# 找到最大运输重量
ans = 0
for x in range(a + 1):
    for y in range(b + 1):
        if dp[x][y] != float('-inf'):
            ans = max(ans, dp[x][y])

print(ans)

# source:https://leetcode.cn/problems/sum-of-distances-in-tree/ 树形DP 换根
class Solution:
    def sumOfDistancesInTree(self, n: int, edges: List[List[int]]) -> List[int]:
        store = [[] for _ in range(n)]
        for i, j in edges:
            store[i].append(j)
            store[j].append(i)
        
        ans = [0]*n
        size = [1]*n
        def dfs(i, fa, depth):
            ans[0] += depth
            for j in store[i]:
                if j != fa:
                    dfs(j, i, depth+1)
                    size[i] += size[j]
        dfs(0, -1, 0)

        def cal(i, fa):
            for j in store[i]:
                if j != fa:
                    ans[j] = ans[i] + (n - 2*size[j])  # core method
                    cal(j, i)
        cal(0, -1)
        return ans

# source:https://leetcode.cn/problems/count-number-of-possible-root-nodes/ 树形DP 换根
class Solution:
    def rootCount(self, edges: List[List[int]], guesses: List[List[int]], k: int) -> int:
        n = len(edges)
        store = [[] for _ in range(n+1)]
        for i, j in edges:
            store[i].append(j)
            store[j].append(i)
        s = {(x, y) for x, y in guesses}
        cnt = ans = 0
        def dfs(i, fa):
            nonlocal cnt
            for j in store[i]:
                if j != fa:
                    if (i, j) in s:
                        cnt += 1
                    dfs(j, i)
        dfs(0, -1)
        # print(cnt)
        def cal(i, fa, count):
            nonlocal ans
            ans += count >= k
            for j in store[i]:
                if j != fa:
                    cal(j, i, count - ((i, j) in s) + ((j, i) in s))
        cal(0, -1, cnt)
        return ans